
********************************************************
********************************************************
******* THIS FILE GENERATES THE FEE-HASSLE FIGURE ******
********************************************************
********************************************************
set scheme uncluttered

cap log close 

di "This run uses code version from 2023/03/29"

use `"$indices/fee_indices.dta"', clear 

drop if pay_type_pooled == 3

merge m:1 payee_state_cd pay_type_pooled using `"$indices/cip_indices.dta"', keepusing(*CIP*)
keep if _merge == 3
drop _merge 

gegen mean_fee = mean(pi_c_FE_cpt_line)
gen pi_c_FE_cpt_line_a = (pi_c_FE_cpt_line - mean_fee)


// fee without imputation and CIP with selection  
gr tw scatter pi_c_FE_cpt_line_a lev_CIP_FE_nofe if pay_type_pooled == 2, msymbol(diamond_hollow) mlabcolor(navy)  mcolor(none) mlab(payee_state_cd)  mlabposition(0)  || scatter pi_c_FE_cpt_line_a lev_CIP_FE_nofe if pay_type_pooled == 1, msymbol(circle_hollow) mlwidth(vthin) mcolor(red) yti("Log fee index ({stSymbol:p})", size(medlarge)) xti("CIP share index ({stSymbol:t})", size(medlarge)) leg(order(1 "Medicaid" 2 "Medicare"))  ylab(0.3365 "+40%" 0.18233 "+20%" 0 "0" -0.18233 "-20%" -0.3365 "-40%" -0.47 "-60%")   
graph export `"$github/billing-costs/paper/PaperInputs/CIP_vs_fee_selection.pdf"', replace 
graph export `"$github/billing-costs/paper/PaperInputs/CIP_vs_fee_selection.png"', replace 




